printf and manipulating its outputs

The ANSI C Programming Languange - Book

Created: 2022-08-14
Tags: #fleeting


How to print leading zeros?

%3i prints int with 3 whole num digits.
Like 031
This is also how you get leading zeros in numbers

%5.2f prints floating with 5 whole num digits and 2 decimal digits
Like 01433.00

How to print a float without decimals?

%.0f prints a floating number without decimals :D
Like 2

References